#include "createNodeButton.h"
#include "renderer.h"
#include "input.h"


CreateNodeButton::CreateNodeButton(){}

CreateNodeButton::~CreateNodeButton(){}


void CreateNodeButton::setup(){

Button::setup();
}

void CreateNodeButton::update(double deltaTime){

if (input->focusButton==this && myNode)
  {
  myNode->location.x=input->mouseX;
  myNode->location.y=input->mouseY;
  }

}

void CreateNodeButton::mouseOver(){

Button::mouseOver();
}

void CreateNodeButton::mouseDrag(){}

void CreateNodeButton::clickedLeft(){

    input->focusButton=this;

    createNewActor(buttonProperty);

    //we need to do this to make it possible to generate ScriptNodes (with only one NodeIO)!!!!
    myNode=(Node*) renderer->nodeList.back();

    cout << "referencing node: " << myNode->name << endl;

    myNode->setup();
}

void CreateNodeButton::clickedRight(){}

void CreateNodeButton::focusClick(){

Button::focusClick();
}

void CreateNodeButton::deselect(int depth){

Button::deselect(depth);
}

void CreateNodeButton::create(){renderer->addButton(this);}
